<template>
  <p>Axios页</p>
  <button @click="getData">获取学生数据</button>
  <table>
    <tr>
      <th>学号</th>
      <th>姓名</th>
      <th>性别</th>
      <th>分数</th>
    </tr>
    <tr v-for="item in stundents">
      <td>{{ item.id }}</td>
      <td>{{ item.name }}</td>
      <td>{{ item.sex }}</td>
      <td>{{ item.score }}</td>
    </tr>
  </table>
</template>

<script>
export default {
  name: 'axiosTest',
  data() {
    return {
      stundents: []
    }
  },
  methods: {
    getData() {
      this.$http
        .get('/stundents')
        .then((res) => {
          this.stundents = res.data
        })
    }
  }
}
</script>